package com.zcsy.manage.service.base.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zcsy.manage.model.base.ShopBanner;
import com.zcsy.manage.persistence.base.ShopBannerDao;
import com.zcsy.manage.service.base.IShopBannerService;

/**
 * 
 * @Title: ShopBannerServiceImpl.java
 * @Package： com.zcsy.manage.service.base.impl 
 * @Description: 店铺装修service层实现类
 *
 * @author lilan 1063972142@qq.com
 * @Copyright: 2015 武汉恒数利通技术有限公司 All rights reserved.
 * @date 2016年8月30日
 * @version 1.0
 * @see JDK1.7.0_75
 * @since
 */
@Service
public class ShopBannerServiceImpl implements IShopBannerService{

	@Autowired
	private ShopBannerDao shopBannerDao;
	
	@Override
	public int insert(ShopBanner shopBanner) {
		return shopBannerDao.insert(shopBanner);
	}

	@Override
	public int update(ShopBanner shopBanner) {
		ShopBanner oldBanner = shopBannerDao.selectByPrimaryKey(shopBanner.getId());
		
		oldBanner.setTitle(shopBanner.getTitle());
		oldBanner.setMemo(shopBanner.getMemo());
		oldBanner.setObjType(shopBanner.getObjType());
		oldBanner.setObjId(shopBanner.getObjId());
		oldBanner.setImg(shopBanner.getImg());
		oldBanner.setSort(shopBanner.getSort());
		oldBanner.setShopId(shopBanner.getShopId());
		oldBanner.setGoodsLogo(shopBanner.getGoodsLogo());
		oldBanner.setGoodsName(shopBanner.getGoodsName());
		oldBanner.setUrl(shopBanner.getUrl());
		oldBanner.setUserAccount(shopBanner.getUserAccount());
		oldBanner.setUpdateTime(shopBanner.getUpdateTime());
		
		return shopBannerDao.update(oldBanner);
	}

	@Override
	public int deleteByPrimaryKey(String id) {
		return shopBannerDao.deleteByPrimaryKey(id);
	}

	@Override
	public ShopBanner selectByPrimaryKey(String id) {
		return shopBannerDao.selectByPrimaryKey(id);
	}

	@Override
	public List<ShopBanner> selectBannerByKeyword(ShopBanner shopBanner) {
		return shopBannerDao.selectBannerByKeyword(shopBanner);
	}

	@Override
	public int updateSort(ShopBanner shopBanner) {
		return shopBannerDao.updateSort(shopBanner);
	}
	
	@Override
	public List<ShopBanner> selectBannerByShopId(String shopId){
		return shopBannerDao.selectBannerByShopId(shopId);
	}


}
